<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8"%>
<%@page import="crm.model.Schedule"%>
<%@page import="crm.control.ScheduleControl"%>
<%@page import="crm.model.Employees"%>
<%@page import="crm.util.DateTime"%>
<%@page import="crm.util.ParamUtil"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>My JSP 'schedule_update_do.jsp' starting page</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  
  <body>
  	<%
  		Employees employees = (Employees)session.getAttribute("user");
  		request.setCharacterEncoding("UTF-8");
  		int id = Integer.parseInt(request.getParameter("id"));
  		Schedule schedule = ScheduleControl.getSecheduleInfomation(id);
  		schedule.setCreater(employees.getId());
  		schedule.setCreate_time(DateTime.DateTime());
  		schedule.setContent(ParamUtil.getString(request, "content","null"));
  		schedule.setRelated_customer(ParamUtil.getString(request, "related_customer"));
  		schedule.setRelated_receipt(ParamUtil.getString(request, "related_receipt"));
  		schedule.setTheme(ParamUtil.getString(request, "theme"));
  		if(ScheduleControl.updateSchedule(schedule)){
  	 %>
  	 <script type="text/javascript">
  	 	alert("修改成功！");
  	 	location.href="schedule.jsp"
  	 </script>
  	 <%}else{%>
  	 	<script type="text/javascript">
  	 		alert("修改失败！");
  	 		location.href="schedule.jsp"
  	 	</script>
  	 <%} %>
  	 %>
  </body>
</html>
